
#pragma once

#include "control/bmpbtn.h"
#include "Control\Control.h"
#include "AlphaRes.h"
#include "BaseICtrl.h"

/*
	btn have multi state
*/


class  GUI_API CIAlphaMulBtn 
:public CBaseICtrl
{
public:
	CIAlphaMulBtn(void);
	CIAlphaMulBtn(UINT nID );
	CIAlphaMulBtn(wstring strCaption,UINT nID );
	CIAlphaMulBtn(DWORD dwStyle,wstring strCaption, const CRect &rc, UINT nID  );
	CIAlphaMulBtn(DWORD dwStyle, wstring strCaption, int x, int y, int cx, int cy, UINT nID  );

	virtual ~CIAlphaMulBtn(void);
	virtual void Click(DWORD dwClick, POINT pt);

public:
	//this function will clear m_VecMulResBtn first
	void  ReInitBtnState( int StateCount );

	// conctrol only have one image
	virtual BOOL	LoadRes( wstring strRes,CMyUnCompress* pPack=NULL );
	//if contrl only have one img,this function just like LoadRes,here the same
	virtual BOOL	LoadStateRes( wstring strRes,int nState,CMyUnCompress* pPack=NULL );
	
	BOOL	InitStateResRect( wstring strRes,int nState,LPRECT pRect, CMyUnCompress* pPack=NULL );

	void	SetStateRect( int nState,LPRECT pRC );

	void	SetBtnCurState( int nState );
	CRect	GetCurrentRect();
	BOOL	CloneStateBtn( int nSrcSt,int dst_State,LPRECT prcDst );


	inline void SetTextOffset(CSize szOffset){
		m_szTextOffset = szOffset;
	}

protected:
	void	ReleaseMulResState( );

protected:
	vector<CFAlphaRes*>		m_VecMulResBtn;
	vector<CRect>			m_VecMulRect;

	USHORT				m_nBtnState;
	CSize				m_szTextOffset;

public:
	virtual void	Paint(CDC* pDC);
	virtual void	ImprovePaint( HANDLE hDB ,HDC hdc =NULL );
	virtual void	ImproveStatePaint( HANDLE hDB ,int state );
	virtual void	PaintCaption( HDC hdcTxt );

	void Init();

};
